Skip to content

Complications on the watch, and a Wear artifact beside the phone APK - #5583

Merged
shai-almog merged 96 commits into
masterfrom
feat-watch-complications
Aug 23, 2026
Merged

Complications on the watch, and a Wear artifact beside the phone APK#5583
shai-almog merged 96 commits into
masterfrom
feat-watch-complications

Conversation

@shai-almog

Copy link
Copy Markdown
Collaborator

Closes the gap the wearables chapter has been documenting since watch support shipped: a developer could declare WidgetSize.WATCH_CIRCULAR, the value serialized onto the wire, and nothing on any device ever showed it.

Five places in the code said so out loud. All five are now deleted rather than reworded.

Apple Watch

A CN1WatchWidgets WidgetKit extension, embedded in the watch app rather than the phone app. That single choice is what makes companion and standalone need no separate handling at all: the companion case already copies the finished watch app into the phone app with the .appex inside it, and the platform filter that keeps the watch tree out of the Catalyst slice covers the extension for free.

Three premises turned out to be wrong, and each changed the design:

  • CN1DescriptorWidget.swift did not compile for watchOS. systemSmall/Medium/Large/ExtraLarge are @available(watchOS, unavailable) — unnameable, not merely absent — and the file named all four unconditionally. UIColor.systemBackground, UIColor(dynamicProvider:) and UIGraphicsImageRenderer are all API_UNAVAILABLE(watchos) too.
  • CN1_USE_WIDGETS was explicitly switched off on the watch slice, so Surfaces.publish() from a watch app was a hard no-op that reported success.
  • The deployment floor is watchOS 10, not WidgetKit's 9. containerBackground(for:) is watchOS 10 and every generated widget applies it, so 9.0 fails the build rather than losing the background.

The substitutes are the right answers rather than degradations: a watch face composites over black and has no light appearance, so the background role is black and a light/dark pair resolves to its dark half.

Also here: complication taps reach the action handler through the SwiftUI scene (there is no UIApplicationDelegate on watchOS), and the phone→watch mirror.

Wear OS

Complications and Tiles, generated per watch-bearing kind, plus the companion Wear artifact that has never been produced.

A complication is not a small widget, and the code says so. A watch face asks for one typed value and composes it into its own design, so the node tree is flattened and mined for content rather than rendered — at most two text nodes and one image. Everything dropped is logged once per render, so a developer whose careful layout arrives as one number learns that is by design.

A Tile does render the tree, and two things come out better than on a phone widget: circular progress renders natively where RemoteViews degrades to a linear bar, and per-node taps work where a small iOS widget honors only the root. The honest limitation is time — a countdown freezes and refreshes from the timeline, because ProtoLayout's dynamic expressions are version-sensitive and a frozen value that's always right beats a ticking one that works on some watches.

The companion module shares the app module's source tree rather than copying it. Both modules declare the same namespace — required, not merely convenient, because the shared sources refer to R unqualified from the app's package. That AGP permits this was verified with a throwaway two-module Gradle project before the phase was written.

The mirror

A watch app has its own storage; nothing the phone writes is visible there. On Apple the App Group identifier is the same string but resolves to a watch-local container, and on Wear OS the two apps are separate installs. So a phone-side publish reaches a complication only because the framework carries it.

It lives in the port on both platforms, for opposite reasons that point the same way. On Apple a core reference to com.codename1.wearable would flip usesWearable for every surfaces app and link WatchConnectivity into apps that never asked. On Android Executor.scanClassesForPermissions reads the app's own classes and not the core, so the same reference would fail to flip it and the mirror would silently do nothing.

Apple uses the one WatchConnectivity API that wakes the watch app in the background, which is budgeted at about fifty transfers a day; spending one when no complication is placed wastes what the app will want later, so that and an exhausted budget fall back to a queued transfer. Over the size cap the imagery is shed first — a complication rendering its numbers with a missing glyph beats one that never updates.

Applied on the watch headlessly: a file write and a re-render request, touching no framework state. The wake exists to refresh a complication, not to bring a UI forward nobody asked for.

Two fixes that stand alone

  • CN1BuildMojo collapsed same-extension artifacts onto one path. Two .apk entries in result.zip overwrote each other, corrupting the primary artifact, silently. Role suffixes now survive into the copied name.
  • publishRemote discarded its image side-map unconditionally, so a server-pushed descriptor referencing art has never rendered it.

Verification

  • Generated watch extension typechecks against the real watchOS 26.2 SDK; the iOS one still typechecks against the iOS SDK from the same manifest.
  • Surfaces natives compile for both platforms; check-native-signatures reports 0 fatal (down from 4 — the earlier "fatals" were stale-build artifacts).
  • WearGlueCompilesTest compiles the injected Wear services against the real CN1WatchSurface plus a 37-file stub tree, so a service that drifts from the reader's contract fails here rather than in a customer's Gradle build. Confirmed to fail when drift is injected.
  • SurfacesSwiftWatchPortabilityTest is the half that runs on a CI leg with no Xcode; confirmed to fail when a guard is removed.
  • 917 plugin + 5197 core tests green. SpotBugs zero findings on both modules. Copyright, ASCII, markdown-javadoc and cast-semantics gates all pass.
  • Docs: Vale 0, LanguageTool 0, paragraph-capitalization 0, asciidoctor clean.
  • The CI sample now declares watch families, so build-ios-watch compiles the extension on every PR and asserts the .appex is embedded at the right nesting.

What is not verified

  • The cloud signer embedding a watchOS profile into a doubly-nested .appex. Nothing in this repo does that work. Local ios-source with automatic signing is unaffected.
  • A real Wear OS emulator. The generated-project structure is asserted, and the injected services compile, but nobody has placed a complication on a face yet.
  • The build server honouring cn1-artifacts.properties. That contract is written but its other half lives out of repo — until it ships, the companion Wear artifact is verifiable through android-source plus a local Gradle run.
  • Play's Wear multi-APK version-code direction is argued from how feature filtering works, not confirmed against Play Console.

Twin PR in BuildDaemon mirrors the builder half.

🤖 Generated with Claude Code

shai-almog and others added 11 commits August 21, 2026 16:38
Three preliminaries for generating watch complications, each of which stands on
its own.

A result entry's role suffix now survives into the copied artifact name. Every
entry used to land on target/<finalName><extension>, keyed on the extension
alone, so a build returning two artifacts of the same kind -- a phone APK and a
companion Wear APK beside it -- collapsed both onto one path and the last one
written won. That corrupts the primary artifact, not merely the secondary one,
and it does it silently.

The family classification moves into SurfaceKindFamilies, which also reads the
portable "families" key with "iosFamilies" as its legacy spelling. The Android
builder has to tell a home-screen kind from a complication kind and is not going
to parse a key with "ios" in its name. Delegation rather than a second copy,
because the rule is subtle enough that three call sites once implemented it as
startsWith("watch") and all three got accessoryCircular wrong.

The shared surfaces Swift now compiles for watchOS. Four WidgetKit system
families are @available(watchOS, unavailable) -- unnameable, not merely absent --
and UIColor.systemBackground, UIColor(dynamicProvider:) and
UIGraphicsImageRenderer are all API_UNAVAILABLE(watchos); the file named all of
them unconditionally. The substitutes are the right answers rather than
degradations: a watch face composites over black and has no light appearance, so
the background role is black and a light/dark pair resolves to its dark half.
Images downsample through ImageIO, which decodes at the target size so the
full-size bitmap is never resident, at a quarter of the phone's ceiling.

Verified by typechecking the sources against both the watchOS and iOS SDKs.
SurfacesSwiftWatchPortabilityTest is the half that also runs on a CI leg with no
Xcode; it was confirmed to fail when the systemBackground guard is removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
setWatchTarget(true) builds a second WidgetKit extension for the watch app,
where the first one is built for the phone. They share every Swift source that
can be shared and differ in which families they may name.

The dead watchTarget parameter that has been threaded through familiesSwift,
watchOnlyFamiliesSwift and mapFamily since the families were introduced finally
has a caller -- but it was not correct as written. With watchTarget true it
still mapped small/medium/large onto .systemSmall and friends, which are
@available(watchOS, unavailable): unnameable there, not merely absent, so the
watch bundle would have failed to compile rather than showing a widget nobody
wanted. Those four and lockscreen now resolve to no family in a watch target,
and the home-screen fallback for a kind with no usable family is suppressed
there too. In the other direction accessoryCorner needs no os(watchOS) guard
inside a target whose SUPPORTED_PLATFORMS is watchOS alone.

The rest follows the same split: the two ActivityKit sources are never shipped
to the watch and the live activity never joins its bundle, the widget-count
limit counts the kinds this flavour actually hosts, and the build settings
describe a watch target -- WATCHOS_DEPLOYMENT_TARGET, SDKROOT, device family 4,
arm64_32 -- with ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES off, because the watch
app already embeds the runtime for everything nested inside it.

The floor is watchOS 10.0, not WidgetKit's own 9.0: every generated widget
applies containerBackground(for:), which is watchOS 10, so a lower target does
not lose the background -- it fails the build. A lower one is refused with that
reason.

Verified by generating a watch extension from a mixed manifest and typechecking
the whole thing against the watchOS 26.2 SDK, and by generating the iOS one from
the same manifest and typechecking it against the iOS SDK.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CN1_USE_WIDGETS was undone for watchOS alongside tvOS, so every surfaces native
compiled to its unsupported stub and Surfaces.publish() from a watch app was a
hard no-op that reported success. tvOS keeps the undef -- it has no WidgetKit at
all -- but the watch does not: a complication is a WidgetKit widget in an
accessory family, hosted by the watch app's own extension and fed from the
watch's own App Group container.

That container is the counter-intuitive part and is now written down where the
guard used to be. The identifier is the same string as the phone's; the
container behind it is a separate directory on the watch. So the watch has to
publish for itself rather than reading what the phone wrote, which is why
restoring these natives is what makes a complication possible at all.

cn1SurfacesMinOSSupported compares the plist floor against the OS actually
running, so its fallback has to be per-platform too. The iOS default of 16.1
compared against a watchOS version is never met, and every watch would have
reported no widget support whatever the plist said.

The four ActivityKit natives now answer for the watch explicitly instead of
relying on the Swift bridge having compiled its bodies out. They keep their
symbols -- the Java methods are reachable from shared code, so removing them
would fail the watch link rather than tree-shake -- and the guard uses #else
rather than an early return so the watch slice compiles no unreachable statement.

Verified by compiling the surfaces native block against both the watchOS and iOS
SDKs, and by typechecking the app-target Swift glue against the watchOS SDK.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The watch app now gets a CN1WatchWidgets target embedded in its own PlugIns
folder, and that single choice is what makes both distributions need no separate
handling: the companion case already copies the finished watch app into the
phone app with the .appex inside it, and the platform filter keeping the watch
tree out of the Mac Catalyst slice covers the extension for free; the standalone
case ships the watch app as the product. There is no branch for either.

The target type is :app_extension. :watch2_extension is the legacy paired
WatchKit app extension -- the same trap as :application versus :watch2_app for
the app target -- while a WidgetKit extension is a plain app extension wherever
Apple ships it.

Generating it belongs here rather than beside the iOS extension because the
watch app target does not exist yet when the schemes ruby runs. So it is written
immediately before the watch builder's own xcodeproj script and wired by that.

Two things the watch target could not previously reach. Its own translation
carries no CN1SurfaceBridge -- only the phone's -src does -- so the natives
found no bridge through NSClassFromString and answered unsupported; the bridge
and its config constant are now added to the watch target by name, de-duped so
the shared-translation case is unaffected. And the entitlements file was gated
on HealthKit alone, which was the only capability the watch did not inherit from
the phone until now; publishing complications adds an App Group. Both are opt-in
and neither implies the other, because granting one that is unused is refused by
entitlement validation rather than ignored.

parseSurfacesManifest no longer returns early when nothing reaches iOS. A
manifest whose every kind is a complication produces no iOS extension and no
phone app-group entitlement, and must still produce a watch one -- that is the
case the watch families exist for. The build now says which of the two happened
instead of reporting that watch kinds appear nowhere.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The cn1ss sample already declares codename1.watchMain and a surfaces kind, so
adding two watch families to that kind is enough to make the build-ios-watch job
generate and compile CN1WatchWidgets for watchOS. That is the only automated
check that the shared surfaces Swift stays portable to a platform with no
UIGraphicsImageRenderer, no UIColor dynamic provider and no system widget
families -- every one of which was a real break.

Keeping small and medium on the same kind preserves the existing iOS coverage,
and the manifest switches to the portable "families" spelling so that path is
exercised too.

The script then asserts the .appex is actually in the watch app's PlugIns
folder, declares the WidgetKit extension point and carries an app group. The
screenshot comparison cannot see any of that, and simctl cannot exercise a
complication at all -- there is no API to place one on a watch face -- so the
wiring needs checking directly or it is not checked.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Tapping a complication launches the watch app with the widgetURL. There is no
UIApplicationDelegate on watchOS, so the SwiftUI scene's onOpenURL is the only
place that URL can be caught -- and nothing was catching it, so the tap opened
the app and the action went nowhere.

The cn1surface:// decode moves out of CodenameOne_GLAppDelegate.m, which is
entirely #if !TARGET_OS_WATCH, into IOSNative.m, which compiles on both. The
delegate now calls it rather than carrying its own copy, so the two platforms
cannot drift on what a surface action means.

Surfaces.dispatchAction already queues until the app registers its handler,
which is what makes this work at all: a complication tap is almost always a
cold start.

The C entry point is declared in the generated watch bridging header, because a
plain C function is invisible to Swift otherwise, and only when the app actually
publishes complications -- an app without them keeps the scene and the header it
had.

Verified by compiling the surfaces native block for watchOS and iOS.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A developer designing a complication previously had nothing to look at. simctl
cannot place one on a watch face, so short of building to a device and adding it
by hand there was no way to see the layout at all -- while every phone family
had a preview from the start.

The Widgets window now lists the four watch families at the accessory families'
own point sizes, and clips the round ones the way a face does. That clip is the
point rather than decoration: a watch face shows nothing a circular complication
draws into its corners, so previewing it square would make a design look fine
that loses content on the device.

layoutForSize gains the two substitutions the platform renderers already make,
so the preview and the device agree on what gets shown. watchCorner borrows the
circular layout -- a corner complication is round, and Wear OS has no corner slot
at all -- and watchRectangular borrows lockscreen, which is the same WidgetKit
family on Apple. Both are closer to what the developer designed than "default",
which may well be a rectangular phone widget.

What this previews is the node tree at the right size and shape, not the
per-platform lowering: Wear OS reduces a complication to typed ComplicationData,
so a layout that looks right here can still lose detail on a face.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
An App Group container is device-local: the watch resolves the same identifier
to a directory of its own, which nothing on the phone can write. So a phone-side
Surfaces.publish() was invisible to a complication however well everything else
was wired, and the developer's only recourse was to hand-roll the transfer.

IOSSurfaceBridge now forwards the descriptor after the local write has already
succeeded, so nothing here can leave the phone's own widget wrong. Which kinds
are worth sending is decided at build time and written into the plist as
CN1SurfacesWatchKinds, so publishing a phone-only kind costs one dictionary
lookup.

The delivery ladder is the interesting part. transferCurrentComplicationUserInfo
is the only WCSession API that wakes the watch app in the background to refresh
a complication, and it is budgeted at roughly fifty a day. Spending one when the
user has placed no complication wastes what the app will want later, so both
that case and an exhausted budget fall back to transferUserInfo -- queued,
unbudgeted, and applied whenever the watch app next runs. That is materially
weaker, which is why it is the fallback rather than the default. Over the 48KB
property-list cap the imagery is shed first, on the grounds that a complication
rendering its numbers with a missing glyph beats one that never updates; over
the cap even then, it gives up and says so.

Imagery travels in the same dictionary rather than through transferFile, which
is a separate unordered queue with no atomicity against the descriptor -- a
complication could render against art that had not landed, which is worse than
a gap.

Applying it on the watch is deliberately headless: a file write and a WidgetKit
poke, touching no Java. The background wake exists to refresh a complication,
and starting the whole application to do a file write would bring a UI forward
nobody asked for. Reserved keys are routed before anything app-visible, the same
way acknowledgement traffic already is, so the app never sees a message it did
not send.

publishRemote grows an images overload, which also fixes a latent gap: it
discarded the side-map unconditionally, so a server-pushed descriptor
referencing art has never rendered it.

Verified by compiling the surfaces natives for watchOS and iOS, and by
check-native-signatures against a rebuilt port -- which reports 0 fatal, the new
byte[][] mangling included.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The Android surfaces codegen never looked at families, so a kind declaring only
watch complications quietly became a home-screen widget -- a surface the
manifest never asked for. It now splits: a kind with a phone family still gets
its AppWidgetProvider, and a watch-bearing kind is collected for the Wear
services instead. iOS has always refused the same thing, so this is the two
platforms agreeing rather than a new rule.

That silence was the real problem, and the "companion Wear APK is not produced
yet" log is replaced by diagnostics that name what actually happens: which kinds
become complications, that watchCorner renders as circular because Wear OS has
no corner slot, that watchRectangular earns a Tile as well, and -- when the
build produces no Wear product at all -- that the declaration reaches no device
and what to set to change that.

watchModuleName answers "which module is the watch product" once, because
everything downstream is the same code and differs only in the destination:
"app" for a standalone build where the single APK is the watch app, "wear" for a
companion build, null for a project that never asked for a watch.

complicationTypes is the mapping WidgetSize already documents, made executable.
It decides whether a complication can be placed in a given slot at all -- a
watch face asks for one specific type and gets nothing if the source does not
offer it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Complications and Tiles now exist on Android, generated per watch-bearing kind,
along with the companion Wear artifact that has never been produced.

The split is deliberate: everything that does not touch androidx.wear lives in
the port and is compiled by this repository, and only the two thin
androidx-facing services ship as build-time resources. An app publishing no
complication must not carry those libraries, but keeping the reader in the port
is what lets CI catch a break in it -- and WearGlueCompilesTest compiles the
injected services against the REAL CN1WatchSurface plus a stub tree, so a
service that drifts from the reader's contract fails here rather than in a
customer's Gradle build naming a file they never wrote.

A complication is not a small widget, and the code says so. A watch face asks
for one typed value and composes it into its own design, so the node tree is
flattened and mined for content rather than rendered; padding, alignment and
colour are the face's business. What is dropped is logged once per render, so a
developer whose careful layout arrives as one number learns that is by design.

A Tile really does render the tree, and two things come out better there than on
a phone widget: circular progress renders natively where RemoteViews degrades to
a linear bar, and per-node taps work where a small iOS widget honours only the
root. The honest limitation is time -- a countdown is frozen and refreshed from
the timeline, because ProtoLayout's dynamic expressions are version-sensitive and
a frozen value that is always correct beats a ticking one that works on some
watches.

The companion module shares the app module's source, resource and asset dirs
rather than copying them, which would roughly double disk and dex time on a
cloud builder for a tree identical apart from one class. Both modules declare
the same namespace -- required, not merely convenient, because the shared
sources refer to R unqualified from the app's package. That AGP permits it was
verified with a throwaway two-module project before this was written.

The mirror lives in the port for a reason that is the opposite of the iOS one
and points the same way: Executor.scanClassesForPermissions reads the app's own
classes and not the core, so a core-level reference to com.codename1.wearable
would fail to turn the Data Layer glue on and the mirror would silently do
nothing. Reserved paths are routed before anything app-visible and without
waking the app, matching how acknowledgement traffic is already handled.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Five statements in the wearables chapter said the opposite of the truth -- that
Wear OS has no companion form, that no complication target is generated on
either platform, that a companion Android build hands back one artifact. They
are deleted rather than reworded, and the summary table with them.

What replaces them is mostly a warning, because the surprising part of this
feature is not that it works but how much a watch face discards. A complication
is not a small widget: the face asks for one typed value and composes it into
its own design, so the node tree is mined for content rather than rendered, and
on Wear OS a kind supplies at most two text nodes and one image. That has a
section of its own, with the per-node mapping in the surfaces chapter, because
someone reading only the "declare a family" paragraph would design something the
face will not show.

Two places the Tile beats the phone widget are written down too -- native
circular progress and per-node taps -- along with the one place it loses, a
frozen countdown, and why a frozen value that is always right beats a ticking one
that works on some watches.

The mirror gets its own section, leading with the fact that makes it necessary:
a watch app has its own storage, so a phone-side publish reaches a complication
only because the framework carries it. Its budgets, caps and degradation are
stated rather than left to be discovered, and so is the cost -- declaring a watch
family on Android puts play-services-wearable in the phone APK.

Both blog posts still documented the retired android.wear hint; they now say what
drives the build, with a note that the old hint keeps working.

Vale, LanguageTool, the paragraph capitalization check and asciidoctor all report
zero across the whole guide.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 822e641e8c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/Android/src/com/codename1/impl/android/surfaces/CN1WatchSurface.java Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Blog prose gate

✅ No net-new prose findings introduced by this PR.

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: No alerts found (report)
  • Paragraph capitalization: No paragraph capitalization issues (report)
  • LanguageTool: No grammar matches (report)
  • Image references: No unused images detected (report)

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

@shai-almog

shai-almog commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 149 screenshots: 149 matched.
Native Windows port, REAL shipping pipeline: the hellocodenameone screenshot suite rendered by a binary CROSS-COMPILED on Linux (clang-cl + xwin, WebView2 linked) and RUN on a Windows x64 runner. Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 63ms / native 5ms = 12.6x speedup
SIMD float-mul (64K x300) java 63ms / native 4ms = 15.7x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 192.000 ms
Base64 CN1 decode 136.000 ms
Base64 SIMD encode 101.000 ms
Base64 encode ratio (SIMD/CN1) 0.526x (47.4% faster)
Base64 SIMD decode 98.000 ms
Base64 decode ratio (SIMD/CN1) 0.721x (27.9% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 21.000 ms
Image createMask (SIMD on) 15.000 ms
Image createMask ratio (SIMD on/off) 0.714x (28.6% faster)
Image applyMask (SIMD off) 46.000 ms
Image applyMask (SIMD on) 37.000 ms
Image applyMask ratio (SIMD on/off) 0.804x (19.6% faster)
Image modifyAlpha (SIMD off) 194.000 ms
Image modifyAlpha (SIMD on) 31.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.160x (84.0% faster)
Image modifyAlpha removeColor (SIMD off) 37.000 ms
Image modifyAlpha removeColor (SIMD on) 27.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.730x (27.0% faster)

@shai-almog

shai-almog commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 149 screenshots: 149 matched.
Native Windows port (x64 / Intel-AMD): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, SSE2 SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 72ms / native 4ms = 18.0x speedup
SIMD float-mul (64K x300) java 69ms / native 4ms = 17.2x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 190.000 ms
Base64 CN1 decode 136.000 ms
Base64 SIMD encode 100.000 ms
Base64 encode ratio (SIMD/CN1) 0.526x (47.4% faster)
Base64 SIMD decode 99.000 ms
Base64 decode ratio (SIMD/CN1) 0.728x (27.2% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 24.000 ms
Image createMask (SIMD on) 20.000 ms
Image createMask ratio (SIMD on/off) 0.833x (16.7% faster)
Image applyMask (SIMD off) 56.000 ms
Image applyMask (SIMD on) 49.000 ms
Image applyMask ratio (SIMD on/off) 0.875x (12.5% faster)
Image modifyAlpha (SIMD off) 51.000 ms
Image modifyAlpha (SIMD on) 48.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.941x (5.9% faster)
Image modifyAlpha removeColor (SIMD off) 61.000 ms
Image modifyAlpha removeColor (SIMD on) 235.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 3.852x (285.2% slower)

@shai-almog

shai-almog commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 149 screenshots: 149 matched.
Native Linux port (x64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub x64 runner. Baseline: scripts/linux/screenshots.

@shai-almog

shai-almog commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 149 screenshots: 149 matched.
Native Linux port (arm64), GTK3/Cairo/Pango, ParparVM bytecode-to-C (no JVM): the hellocodenameone screenshot suite rendered by a native ELF built + run on the GitHub arm64 runner. Baseline: scripts/linux/screenshots-arm.

@shai-almog

shai-almog commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 149 screenshots: 149 matched.
Native Windows port (arm64 / Apple Silicon - Arm): full hellocodenameone screenshot suite rendered offscreen with Direct2D/DirectWrite, plus the real benchmarks (base64 native/CN1/SIMD, image createMask/applyMask/modifyAlpha/PNG/JPEG, NEON SIMD kernels). Compared against the in-repo baseline in scripts/windows/screenshots.

Benchmark Results

Detailed Performance Metrics

Metric Duration
SIMD kernel backend SSE2 (x64) / NEON (arm64) native kernels
SIMD int-add (64K x300) java 54ms / native 4ms = 13.5x speedup
SIMD float-mul (64K x300) java 56ms / native 3ms = 18.6x speedup
SIMD kernel correctness PASS (native result == scalar reference)
Base64 native bridge unavailable (CN1 + SIMD + image benchmarks only)
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 SIMD byte path gated to scalar (CPU autovectorizes scalar; explicit SIMD not beneficial here)
Base64 CN1 encode 244.000 ms
Base64 CN1 decode 128.000 ms
Base64 SIMD encode 65.000 ms
Base64 encode ratio (SIMD/CN1) 0.266x (73.4% faster)
Base64 SIMD decode 63.000 ms
Base64 decode ratio (SIMD/CN1) 0.492x (50.8% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 13.000 ms
Image createMask (SIMD on) 8.000 ms
Image createMask ratio (SIMD on/off) 0.615x (38.5% faster)
Image applyMask (SIMD off) 126.000 ms
Image applyMask (SIMD on) 19.000 ms
Image applyMask ratio (SIMD on/off) 0.151x (84.9% faster)
Image modifyAlpha (SIMD off) 17.000 ms
Image modifyAlpha (SIMD on) 12.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.706x (29.4% faster)
Image modifyAlpha removeColor (SIMD off) 20.000 ms
Image modifyAlpha removeColor (SIMD on) 13.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.650x (35.0% faster)

Five review findings, four of which were the same shape: code that compiles,
never throws, and renders nothing.

**Containers were read under the wrong key.** `SurfaceContainer` serializes its
children as `ch`; both the complication reader and the Tile renderer looked for
`c`. Every row, column and box therefore looked empty, so a complication mined a
layout with no text, no progress and no imagery in it and a Tile rendered
nothing. That is indistinguishable from an app that published nothing, which is
why it survived a green build.

**Dynamic nodes carry no text to interpolate.** A `dyn` node serializes a style
plus a date or a dateKey, so asking it for `text` resolved to an empty string and
every countdown, clock and relative date vanished. They now go through the core's
own formatter -- made public rather than copied -- so a countdown reads the same
on a watch face as in the simulator preview and on a home screen.

Both are now pinned by SurfaceWatchWireFormatTest, which asserts the field names
against the serializer itself. The readers live in the Android port and cannot be
unit tested from there, but the wire format can be, and that is what makes this
kind of drift visible instead of silent.

**A Tile tap dropped its action.** A Clickable's id is ProtoLayout interaction
metadata and never reaches the started activity, so the trampoline -- which
dispatches only when EXTRA_ACTION_ID is present -- opened the app and discarded
the action id, source and parameters. The extras are attached explicitly now, the
same three a widget tap sends.

**A companion build raised the phone's minSdk.** Declaring a watch family pushed
the shared floor to 26 before the phone module's Gradle file was written, so a
phone APK that had supported API 21-25 became uninstallable on the devices it
already served. The floor now rises only for a standalone build, where the app
module IS the watch product; the wear module sets its own.

**Mirrored artwork never triggered a redraw.** A file transfer is asynchronous
and unordered against the descriptor, so art routinely lands after the timeline
that references it -- and only the descriptor asked for a refresh. The first
render showed a gap and nothing asked again until the next publish.

Also fixes the two SpotBugs findings that failed CI: mkdirs() return values were
ignored. The naive check is wrong here, since mkdirs() answers false both when
the directory could not be created and when it already exists -- which is the
common case -- so existence afterwards is what the callers test.

SpotBugs is now zero across android, ios, codenameone-maven-plugin and
core-unittests; 917 plugin and 5202 core tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad8aed6721

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shai-almog

shai-almog commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

Compared 12 screenshots: 12 matched.
✅ JavaSE simulator integration screenshots matched stored baselines.

Four more findings from the second review round, three of which meant a
generated artifact could not work at all.

**The watch slice lost the surfaces define.** CN1_USE_WIDGETS was still flipped
only for surfacesExtensionEnabled, so a manifest declaring nothing but
complications compiled the watch slice without it -- and since the
WatchConnectivity delegate calls cn1_watch_apply_mirrored_surface, which that
define guards, the watch slice failed to LINK rather than merely doing nothing.

That edit was written once before and lost: a patch script asserted on a later
anchor and never wrote the file. The same failure ate the daemon's
appendWidgetExtension call site. Both are now verified present rather than
assumed.

**The Wear module declared no Data Layer listener.** Its manifest is selected
outright by the module's sourceSets rather than merged with the phone's, so
nothing the phone declares reaches it -- and the watch needs this one more than
the phone does, being the half that RECEIVES a mirrored complication. Play
services had nothing to bind in the watch APK, so every mirrored descriptor was
dropped and complications stayed at whatever the watch had published for itself.

**Tile padding was read as an object.** SurfaceNode serializes it as the array
[top, right, bottom, left], which is what the RemoteViews renderer reads, so
asking for an object returned null for every valid descriptor and all declared
padding was silently discarded.

**A Tile's vector resources were keyed by object identity.** The layout request
and the resources request are separate calls that each re-read and re-parse the
timeline, so the two ids never matched: the layout referenced a resource the
returned map did not contain and every vector rendered as a missing image. The
id now comes from the node's serialized content, which is equal across parses --
and two identical vectors sharing one resource is correct, since they draw the
same thing.

SurfaceWatchWireFormatTest grows the padding and vector cases, so the class of
bug that produced three of these four -- reading a field the serializer does not
write -- is pinned against the serializer rather than found by review.

SpotBugs zero across android, ios, codenameone-maven-plugin and core-unittests;
917 plugin and 5204 core tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare Preview

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: badd9cd1fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/iOSPort/src/com/codename1/impl/ios/IOSSurfaceBridge.java Outdated
The Android CI failure and four more review findings, all of them the same
mistake in different places: the phone and the watch are separate products in a
companion build, and things scoped to one kept reaching the other.

**The androidx.wear libraries reached the phone module.** They went into the
shared gradleDependencies hint, which in a companion build feeds both modules --
and they declare minSdk 26 while the phone keeps its own floor. A phone app on
API 24 therefore stopped building the moment a watch family was declared, failing
its manifest merge against libraries it never uses. They now go into the wear
module's own dependency block, and only a standalone build -- where that single
module IS the watch -- puts them in the shared one.

**The Data Layer glue was decided before the kinds were parsed**, so
watchSurfaceKinds was always empty at that point. An app that publishes
complications and never writes a line of com.codename1.wearable got no glue, no
dependency and an empty listener declaration -- the mirror had no transport at
either end. The block moves after the surfaces parse.

**A watch-only manifest could not mirror at all.** The phone was deliberately
left without the App Group entitlement, so its container did not resolve,
areWidgetsSupported() answered false, and Surfaces.publish() returned before the
bridge -- taking the mirror with it. The one manifest this feature exists for was
the one that could not update its own complications. The group is genuinely part
of the plumbing on both bundles and is now entitled on both.

**The Wear manifest declared no INTERNET permission.** It receives only the
scanned permissions, not the base ones, and is selected outright rather than
merged -- so a watchMain making an ordinary Codename One network request failed
while the same code worked on the phone.

**The watch bundle declared no cn1surface URL scheme.** A complication supplies a
cn1surface:// widgetURL and the generated scene waits for it in onOpenURL, but
the watch is a separate bundle inheriting none of the phone's URL types. watchOS
had nothing to route the tap to, so the whole tap-dispatch path was inert.

Two new tests pin the module boundary: that a companion phone module carries no
androidx.wear dependency, and that the watch bundle declares the scheme when it
hosts a complication and does not otherwise.

SpotBugs zero across android, ios and codenameone-maven-plugin; 920 plugin tests
pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4952d5c96

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The CI failure and two more review findings, all from the same root: the Wear
module's build.gradle is derived from the phone's by textual substitution, and a
generated Gradle file only fails when Gradle evaluates it -- twenty minutes after
the mistake, in a job that names none of it.

**The androidx.wear dependency landed in the buildscript block.** The anchor was
"dependencies {", which matches the indented buildscript block FIRST -- and
String.replace hits every occurrence -- so an implementation() call went into
buildscript's dependency handler, where the method does not exist. The whole
:wear project failed to evaluate. Anchored on "\ndependencies {" now, which only
the project block matches.

**The Wear module looked for a keystore beside itself.** Gradle resolves
file("keyStore") relative to the project it appears in, and the certificate is
written only to the app module -- so a companion release build failed to
CONFIGURE, taking the phone artifact with it. Not the watch half degrading: the
whole build not starting.

**The generated services were written into the phone's source root.** The wear
module shares that directory, so the phone compiled androidx.wear imports it has
no libraries for -- the exact mirror of the dependency-scoping fix that preceded
it. They now go to the wear module's own root. The kind-list resource stays on
the phone deliberately, because the mirror reads it THERE to decide what to send.

**The Tile service was copied whether or not a Tile was declared**, while its
dependencies were added only for a rectangular family. Gradle compiles every
source in the tree, so a complication-only build failed on unresolved imports.

The derivation is now a static function, and WearModuleGradleTest pins each
substitution against a build.gradle shaped like the real one -- the dependency
landing in the project block and not buildscript's, the keystore reachable, the
libraries shared, the phone's floor untouched. It calls the real builder rather
than reproducing it, and was confirmed to fail on the exact anchor bug that broke
CI. Two more tests cover where the services are generated and which are copied.

SpotBugs zero across android, ios and codenameone-maven-plugin; 928 plugin tests
pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2c4b52438

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Two breaks in last round's push retargeting, both of which would have
failed the wear build outright.

The exclusion removed BOTH copies. A Gradle exclude applies to the whole
source set, and the phone root and the module's own root hold the same
relative path -- so '**/StubUtil.java' took out the watch-specific
replacement along with the phone's, leaving the shared messaging service
referencing a class that was no longer compiled at all. It is scoped by
absolute path now, so only the file under app/src/main/java is dropped.

And the replacement was missing getMain(). Every bundled
CN1FirebaseMessagingService template calls it, so a companion build with
FCM failed on a class the developer never wrote. All three of the phone
copy's methods are mirrored now, with the same visibility and return types
-- getMain package-private and returning Object, as it is there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53704d39c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CodenameOne/src/com/codename1/surfaces/Surfaces.java
…tands still

An image name is a CLAIM about the bytes beside it, and a descriptor from a
server or the watch mirror came from outside this process. iOS skips
writing a blob whose file already exists, on the strength of that claim --
so corrupted bytes landing first cannot be repaired by any later legitimate
publish, and the surface shows wrong artwork for good. Hash-shaped names
are now checked against their content, reusing the serializer's own fnv1a
rather than a second copy. A name that was never a hash is passed through
rather than refused for failing a test that does not apply to it.

Tile freshness claimed movement from things that had stopped moving. A
finished interval is clamped at its completed value, a time or date style
formats the node's own fixed timestamp, and an expired countdown sits at
zero -- yet each of them asked for a rebuild every minute, for ever,
redrawing an identical Tile at the cost of the refresh budget and the
battery. The question is now whether the content is still moving, not
whether it is the kind of content that can.

And an interval sample whose entry cannot render the requested type left
its stretch uncovered: the base entry had already been ended at the first
sample, so the timeline fell back to its default -- the older reading,
resurfacing after it stopped being current. It substitutes no-data, exactly
as the main loop does.

hasDynamicText went with the freshness change; nothing called it any more.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7501069273

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

shai-almog and others added 2 commits August 23, 2026 17:38
Four refinements, all of the same shape: a value the face could advance was
being handed over frozen, or not handed over at all.

The interval sampler stopped short of the interval's own end, so a
twelve-step gauge climbed to about eleven twelfths and stayed there -- the
last entry ran on indefinitely holding a partial value and the one moment
the bar is actually full was never shown. The endpoint is emitted when the
interval finishes inside the reading; when a flip covers it instead,
nothing is added, because the flip already ends that entry. Checked against
a whole interval, one clipped by a flip, and one already over.

A SHORT_TEXT title is displayed and could tick, and did not: a countdown
put in the second node froze exactly as the primary one used to.

A RANGED_VALUE description and a LONG_TEXT description whose title is the
only moving part were both still request-time strings, so a screen reader
announced a time long after the face had moved on. Whichever part actually
moves now describes the whole -- the body when both move, being the value
rather than the label.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
collectStaleImages hung off read(), but a complication renders through
readTimeline and a Tile's resource rebuild through readAllEntries -- so a
kind declaring only watch families never took the one path that sweeps.
Those are exactly the watches that need it: the mirror is their only source
of artwork, so a blob spared by the grace period was never reconsidered and
repeated delayed deliveries grew storage without bound.

Reading is the durable hook because it always happens again, and that only
holds if every reader does it. All three now do.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fe3a9923a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The active reading's own start is in the past, so sampling from there
emitted timeline entries whose intervals already cover the present -- and
one of them then overrides the default, which is the only value built for
the current moment. A week-long interval sampled twelve times showed a
gauge fourteen hours stale the instant it appeared. Sampling starts no
earlier than now; a future reading is unaffected, because now is before its
start and the clamp does nothing there. Checked against both.

And a Tile treated an interval that had not BEGUN as moving, because the
check asked only whether it had ended. A reading published hours ahead
therefore asked for a rebuild every minute throughout, redrawing a bar
clamped at zero. Running now means started as well as unfinished.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5693f434bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Refusing periodic refresh before an interval begins was right -- the bar is
clamped at zero until then, and asking every minute redrew an identical
Tile for hours. On its own, though, it left nothing to wake the Tile AT the
start, so a reading with no flip date would have sat at zero indefinitely:
the fix for the waste created a freeze.

The freshness is now the earlier of the flip date and the moment something
starts moving. One refresh at that moment is enough -- the rebuild then
sees the interval running and asks for the periodic rate itself.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34eb5651de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

A static value beside a ticking title left the description a snapshot: the
visible title advanced while a screen reader went on announcing its
request-time value, and with no update period nothing corrected it. The
rule the long-text branch already follows now holds here as well --
whichever part moves describes the whole, the value first and then the
title.

The comment block had accumulated three overlapping paragraphs as this
branch was corrected round by round; it says the whole rule once now.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8db952d2bc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CodenameOne/src/com/codename1/surfaces/Surfaces.java Outdated
reload-at-end did nothing on a companion watch. The refresh request looks
up a background-fetch listener recorded by publishWidgetTimeline -- and a
watch never runs that method: its descriptors arrive through
CN1SurfaceMirror.receive instead. So the preference was unset, the request
returned immediately, and a mirrored complication sat on its final entry
until the phone happened to publish.

Asking the watch was the wrong device anyway. The content is produced on
the phone, so the request now goes back up the link the descriptor came
down: a reserved /cn1surfacereload path, routed like the descriptors
themselves before anything app-visible, answered on the phone by the same
throttled request a widget makes. Absent everywhere it does not apply -- a
build with no wearable link has no bridge to call, and an older injected
bridge has no such method, both of which leave the previous behaviour.

The scheduled form asks immediately rather than at the timeline's end,
because the alarm needs a local component to deliver to and a mirrored
watch has none. That is stated where it is done rather than left to look
like an oversight.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d82b4418a7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

shai-almog and others added 2 commits August 23, 2026 18:22
The peer fallback I added last round loops. A watch with no listener asks
the phone; the phone answers by calling the same method, finds no listener
either, and asks the watch back -- neither ever acquires one, so the two
wake each other until they disconnect. An answer to a peer's request is now
forbidden to ask a peer: it asked because it has nothing, and this device
having nothing either is the end of it, not the start of a round trip.

And the integrity check never ran. Serializer names are "img" plus sixteen
hex digits, while the predicate demanded exactly sixteen characters -- so
it matched nothing the framework produces, and had it matched it would have
compared a prefixed name against an unprefixed hash and rejected every
legitimate blob. Both halves now use the prefix, and a name that was never
a hash is still passed through rather than failing a test that does not
apply to it. Checked on a real generated name: recognised, matching bytes
accepted, corrupted bytes rejected, an app-registered name left alone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This slot shows only an icon, so the content description IS the value to a
screen reader -- and it was a string resolved at request time, announced
long after the face had advanced with no update period to correct it. It
uses the ticking text when there is one, which is now the rule all four
types follow.

The two remaining plain descriptions are the pre-publish placeholder, where
the label is the kind's name and nothing moves.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e2c87247d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/iOSPort/nativeSources/CN1WatchConnectivity.m

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6408d79efb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Only the head of the complication queue is ever handed to WCSession -- that
is what keeps a prioritised transfer from displacing the one before it --
so everything behind it lived in memory alone. A suspension or termination
during a background transfer took those kinds with it, and no system-owned
transfer existed for them either, so their complications stayed stale until
something else published. The queue is parked on disk now and read back on
activation, which is the one thing that always happens whatever brought the
process up. A kind published since the restore is newer than what was
parked, so the parked copy is dropped rather than overwriting it.

The same idiom the received-transfer inbox already uses, and for the same
stated reason: the process does not own its own lifetime.

And a count-up toward a future target reads 0:00 until it arrives, so a
Tile carrying one asked for an identical rebuild every minute through the
whole wait. It is dormant now and wakes at its target, exactly as a
not-yet-started interval does -- the two cases are the same shape, so they
share the one method that decides when to come back.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1987c37b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/iOSPort/nativeSources/CN1WatchConnectivity.m Outdated
shared activates WCSession asynchronously, so the first publish in a fresh
process reaches the mirror before activation completes -- and until it
does, isPaired and isWatchAppInstalled are not reliable and a transfer may
be refused outright. Deciding there discarded the only copy of that payload
on the strength of an answer the session was not ready to give, and nothing
would have sent it again.

An unactivated session now queues instead, which also parks the payload on
disk, and activationDidCompleteWithState sends it once the session can
actually be asked. The queue drain refuses to run before activation for the
same reason: spending payloads on transfers that may be refused is the
discard this queue exists to prevent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44a20b3e9d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/iOSPort/src/com/codename1/impl/ios/IOSSurfaceBridge.java
A publish is a write followed by a hand-off: the platform replaces the
timeline in its container and then gives the same descriptor to the watch,
and the two are only meaningful as a pair. Let two publishes of one kind
interleave and the later write pairs with the earlier hand-off, so the watch
is left holding a descriptor the phone has already replaced -- and left
holding it for good, because nothing publishes again to correct it. The
imagery is worse than stale: both platforms read the blobs back off disk at
hand-off time, so one publish's descriptor could be sent with another's
artwork, a pairing neither publish ever produced.

publish() documents itself as callable from any thread, so two threads
publishing one kind is a supported way to call it. The monitor is per kind
rather than global, since a publish is file I/O plus a synchronous native
call and two kinds have nothing to say to each other. publishRemote takes
the same one: a push landing while the app publishes races identically.

Also returns the Wear module's R8 map with the build. It could not ride the
source export -- that zip excludes every directory named "build", which is
where R8 writes -- so a companion build's watch frames had no map at all.
The new test pins the naming the extractor pairs it by.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e04f11c15

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Ports/iOSPort/nativeSources/CN1WatchConnectivity.m
The delivery ladder ran at the publish: pairing and installed-app first, then
the budgeted complication wake, falling back to a plain queued transfer when
no complication is placed or the daily budget is spent. Only payloads that
wanted the wake were queued, so the queue could send them blind.

Two paths now reach that queue without having been judged. A publish that
arrives before the session activates is queued precisely because the session
cannot be asked yet, and a queue restored from disk was judged in a previous
run of the app, if at all. Both were then sent down the budgeted path
regardless -- spending a transfer on a watch with no complication placed, or
on a budget already exhausted, where the resulting exception retires the
payload. That is the discard the queue exists to prevent.

The ladder moves to the send, which is the only point where every payload
passes through it and where the session's answers are current. The publish
keeps one cheap test, for a phone with no watch at all, so the common install
does not write a queue file and delete it again -- labelled as the fast path
it is, with the authoritative copy naming it.

Also carries android.xmanifest's uses-sdk attributes into the Wear manifest.
A tools:overrideLibrary is how a project accepts a dependency whose manifest
demands a higher minSdk than the app declares, and since the wear module
keeps the phone's dependency graph it merges that same library manifest --
so a project that builds today failed in the wear merge instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@shai-almog
shai-almog merged commit 5f81037 into master Aug 23, 2026
61 checks passed
@shai-almog
shai-almog deleted the feat-watch-complications branch August 23, 2026 18:02
shai-almog added a commit that referenced this pull request Aug 23, 2026
Merged master, which brought in #5583 (complications on the watch, and a Wear
artifact beside the phone APK). It adds ten hints the builders read, and the
catalog gate failed on the merge result: every hint the code reads has to be
described, and the empty baseline means there is nowhere to park one.

That is the gate working, not a conflict. #5583 was written before the catalog
existed, so it had nothing to add its hints to.

Each row's type and default come from the call site rather than from the name:

  android.blockLabel                          boolean, false
  android.surfaces.complicationUpdateSeconds  int, 0
  android.watchModule                         boolean, true
  android.watchVersionCode                    int, no default -- unset means
                                              derive from the offset below
  android.watchVersionCodeOffset              int, 100000000
  android.wear.complicationsVersion           string, 1.2.1
  android.wear.tilesVersion                   string, 1.4.1
  android.wear.protoLayoutVersion             string, 1.2.1
  android.wear.guavaVersion                   string, 31.1-android
  watchNative.surfaces.deploymentTarget       string, 10.0

Catalogued, not annotated: the catalog has to describe every hint, but exposing
one as a typed attribute is a curation decision, and inventing API for somebody
else's feature in a merge commit is not that. They are documented, typed and
value-checked, and can be annotated later without churn.

The one nuance worth recording is watchNative.surfaces.deploymentTarget, whose
default is the watch app's floor rather than the extension's: WidgetKit reaches
back to watchOS 9, but the extension is embedded in the watch app, so the lower
number would advertise support that does not exist.

The regenerated developer-guide table is the only other change -- no annotation
churn, as intended.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
shai-almog added a commit that referenced this pull request Aug 24, 2026
…blished fallback

Three things, two of them master's own red CI that this branch inherits through
the merge commit.

iOS, all four failing jobs: IOSNative.m calls six
com_codename1_impl_ios_IOSWearableCallbacks_* functions without including the
generated header that declares them. clang 17 rejects an implicit declaration
outright, so the phone, Metal and watch targets all failed to compile -- master
has been red on scripts-ios.yml and scripts-ios-native.yml since #5583 landed.
CN1SmartHome.m carries the identical include for IOSHomeCallbacks, the class
this one was modelled on; this one was simply missing. The mangled names
themselves are correct, checked against the six Java signatures.

Android, the instrumentation NPE: dispatchDraw read renderingOperations.size()
and then copied the list, both without the lock the same method takes twenty
lines later to clear it -- while flushGraphics swapped the list out from under it
on the EDT, also unlocked. ArrayList.addAll copies through toArray(), and a
concurrent mutation there returns an array sized for the new contents and padded
with NULLS. Those nulls arrived as AsyncOps and threw out of executeWithClip: a
hard crash on the UI thread, which is what
launchMainActivityAndWaitForDeviceRunner hit. flushGraphics has carried an
"if (o != null)" guard against this same corruption since a user reported it, so
the nulls were known; nothing had established where they came from.

The snapshot and the swap are now both taken under RENDERING_OPERATIONS_LOCK.
Only the copy -- the ops still execute outside it, because that is the frame's
actual drawing and holding a lock there would park the EDT for the whole paint.
The one remaining unguarded read of the field, the flushGraphics wait loop, goes
through a small accessor rather than being left as the exception that teaches
the next reader the field is free to touch. No null guard added in dispatchDraw:
with the copy synchronized the nulls cannot occur, and a guard there would only
hide it if they ever did again.

Third, from review: deleting the checked-in report for a port that has one is
now refused. Making a missing report a supported state was necessary so that
adding a port need not begin by hand-authoring a snapshot -- but absent because
it never existed and absent because someone removed it are different things, and
only the first is harmless. The site serves that file precisely when the data
branch is unreachable, so removing one turns an established column unknown at
the moment the live data is missing. Retiring a port still works: drop it from
the manifest and the check stops looking at it.

Verified: the android module compiles against the freshly installed core and the
new locking is in the bytecode (two monitorenters in dispatchDraw); the six iOS
mangled names match their Java signatures; 66 normalizer tests pass; deleting
tvos.json is refused and restoring it passes; validate, coverage, provenance,
Hugo and validate_port_status.mjs are all green.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant